#include <iostream>

using namespace std;

int op = 0;

int main()
{
	int cnt = 0;
	int t; cin >> t;
	while (t--)
	{
		string s; cin >> s;
		if (s == "login")
		{
			op = 1;
		}
		else if (s == "logout")
		{
			op = 0;
		}
		else if (s == "private")
		{
			if (op == 0) cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}
